C51 COMPILER V9.60.0.0   MAIN                                                              02/02/2023 15:35:32 PAGE 1   


C51 COMPILER V9.60.0.0, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\Release\main.obj
COMPILER INVOKED BY: C:\Keil_v5\C51\BIN\C51.EXE main.c OPTIMIZE(0,SPEED) REGFILE(.\Release\Sample_DrvFMC.ORC) BROWSE INC
                    -DIR(..\..\..\..\C51SIS\C51;..\..\..\Include\Driver) DEBUG OBJECTEXTEND TABS(2) OBJECT(.\Release\main.obj)

line level    source

   1          /**************************************************************************//**
   2           * @file           main.c
   3           * @version        V1.0
   4           * $Revision:      1 $
   5           * $Date:          2017/01/04 $
   6           * @brief          Main function
   7           * @Author         Jeffrey Kang
   8           * @ContactInfo    chkang@esmt.com.tw
   9           *
  10           * @note
  11           *
  12           * Copyright (C) 1998 Elite Semiconductor Memory Technology Corp.
  13           * All rights reserved.
  14           *
  15           ******************************************************************************/
  16          
  17          
  18          #include <REG52.h>
  19          #include "system_FE81001.h"
  20          
  21          void WR_information_block(unsigned char addr ,unsigned char dataH ,unsigned char dataL );   // addr = 0x00
             -~0x17
  22          unsigned int RE_information_block(unsigned char addrL); // addr = 0x00~0x17
  23          
  24          unsigned int RE_flash(addrH,addrL);
  25          
  26          /**
  27           * @brief       delay function
  28           *
  29           * @param       None
  30           *
  31           * @return      None
  32           *
  33           * @details     1. 
  34           */
  35          void delay( void )
  36          {
  37   1        unsigned int i;
  38   1        
  39   1        for( i = 0 ; i < 200 ; i++ ){}
  40   1      }
  41          
  42          
  43          /**
  44           * @brief       main function
  45           *
  46           * @param       None
  47           *
  48           * @return      None
  49           *
  50           * @details     1. 
  51           */
  52          int main( void )
  53          { 
C51 COMPILER V9.60.0.0   MAIN                                                              02/02/2023 15:35:32 PAGE 2   

  54   1        unsigned int RE_data1,RE_data2,RE_data3,RE_data4;
  55   1        
  56   1        /* enable GPIO clock */
  57   1        PORT_PAPBPCPD_Clock_Enable();
  58   1        
  59   1      /* Set PD1. ,PD2.,PD3 output */
  60   1        PORT_SetPDPushPull(BIT1 | BIT2 | BIT3 );
  61   1        
  62   1        PD1 = 0; // LED_G1 On
  63   1        PD2 = 1 ; //LED_R Off
  64   1        PD3= 0;  // LED_G2  On
  65   1        
  66   1        /* enable FMC clock */
  67   1        En_FMC_clk();
  68   1        
  69   1        WR_information_block(0x00,0x88,0x89);
  70   1        RE_data1 = RE_information_block(0x00);
  71   1        
  72   1        WR_information_block(0x01,0x90,0x91);
  73   1        RE_data2 = RE_information_block(0x01);
  74   1        
  75   1        WR_information_block(0x17,0x32,0x33);
  76   1        RE_data3 = RE_information_block(0x17);
  77   1        
  78   1        //Read Falsh
  79   1        RE_data4 = RE_flash(0x0E,0x00);
  80   1        
  81   1        
  82   1        
  83   1        delay();
  84   1        
  85   1        while(1);
  86   1      }
  87          
  88          void WR_information_block(unsigned char addr,unsigned char dataH ,unsigned char dataL)// addr = 0x00~0x17
  89          {
  90   1          /* enable information block */
  91   1          Enable_information_block();                // ISPEN = 0, INFOEN = 1, ISAVB = 1, ISPWDTD = 0
  92   1          
  93   1          /* Write eMTP information block */
  94   1          FMC->fmcadr[0]  = addr;
  95   1          FMC->fmcadr[1]  = 0x00;
  96   1          FMC->fmcdata[0] = dataL;
  97   1          FMC->fmcdata[1] = dataH;
  98   1          FMC->fmccmd     = 0x08;
  99   1          while((FMC->fmcstat & 0x80) == 0x80){
 100   2          }
 101   1        
 102   1          /* disable information block */
 103   1          Disable_information_block();                // ISPEN = 0, INFOEN = 0, ISAVB = 1, ISPWDTD = 0
 104   1        
 105   1      }
 106          
 107          unsigned int RE_information_block(unsigned char addrL)  // addrL = 0x00~0x17
 108          {
 109   1          int infodata;
 110   1          unsigned char data0, data1;
 111   1          /* enable information block */
 112   1          Enable_information_block();                // ISPEN = 0, INFOEN = 1, ISAVB = 1, ISPWDTD = 0
 113   1          
 114   1          FMC->fmcadr[0] = addrL;
 115   1          FMC->fmcadr[1] = 0x00;
C51 COMPILER V9.60.0.0   MAIN                                                              02/02/2023 15:35:32 PAGE 3   

 116   1          FMC->fmccmd    = 0x02;
 117   1          data1          = FMC->fmcdata[1];
 118   1          FMC->fmccmd    = 0x02;
 119   1          data0          = FMC->fmcdata[0];
 120   1          infodata       = (data1 << 8) | data0;
 121   1          
 122   1          /* disable information block */
 123   1          Disable_information_block();                // ISPEN = 0, INFOEN = 0, ISAVB = 1, ISPWDTD = 0
 124   1          return infodata;
 125   1        
 126   1      }
 127          unsigned int RE_flash(addrH,addrL)
 128          {
 129   1          int infodata;
 130   1          unsigned char data0, data1;
 131   1        
 132   1          /* disable information block */
 133   1          Disable_information_block();                // ISPEN = 0, INFOEN = 0, ISAVB = 1, ISPWDTD = 0
 134   1          
 135   1          FMC->fmcadr[0] = addrL;
 136   1          FMC->fmcadr[1] = addrH;
 137   1          FMC->fmccmd    = 0x02;
 138   1          data1          = FMC->fmcdata[1];
 139   1          FMC->fmccmd    = 0x02;
 140   1          data0          = FMC->fmcdata[0];
 141   1          infodata       = (data1 << 8) | data0;
 142   1          
 143   1          return infodata;
 144   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    394    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     26    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
